package com.duoduo.springcloud.config;

import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * GateWayConfig
 *
 * @author qian
 * @version 1.0
 * @date 2020/11/27 11:02
 */
@Configuration
public class GateWayConfig {

    @Bean
    public RouteLocator consumerRoutes(RouteLocatorBuilder builder){
        return builder.routes()
                .route("guonei_route",predicateSpec ->
                        predicateSpec.path("/guonei").uri("http://news.baidu.com/guonei"))
                .route("guoji",predicateSpec -> predicateSpec.path("/guoji").uri("http://news.baidu.com/guoji")).build();
    }
}
